<template>
  <!-- 学生离校退宿页面 -->
  <div class="app-container">
    <!-- 搜索 -->
    <searchForm :formOptions="formOptions" @onSearch="onSearch" />
    <el-table :data="tableData">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column prop="name" label="学号"> </el-table-column>
      <el-table-column prop="name" label="院系"> </el-table-column>
      <el-table-column prop="name" label="专业"> </el-table-column>
      <el-table-column prop="name" label="姓名"> </el-table-column>
      <el-table-column prop="name" label="性别"> </el-table-column>
      <el-table-column prop="address" label="电话"> </el-table-column>
      <el-table-column prop="date" label="辅导员"></el-table-column>
      <el-table-column prop="address" label="辅导员电话"> </el-table-column>
      <el-table-column prop="name" label="楼号"> </el-table-column>
      <el-table-column prop="name" label="宿舍号"> </el-table-column>
      <el-table-column prop="name" label="床位号"> </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="">
          <el-button size="mini" type="text"
            >审批流程详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import searchForm from "../../components/Search/searchForm.vue";
export default {
  components: { searchForm },
  data() {
    return {
      formOptions: [
        {
          label: "楼号",
          prop: "LH",
          element: "el-input",
          placeholder: "请输入楼号",
        },
        {
          label: "层号",
          prop: "CH",
          element: "el-input",
        },
        {
          label: "房间号",
          prop: "FJH",
          element: "el-input",
        },
        {
          label: "学号",
          prop: "XH",
          element: "el-input",
        },
        // {
        //   label: "类型",
        //   prop: "type",
        //   element: "el-select",
        //   options: [
        //     { label: "给点意见", value: "1" },
        //     { label: "售后问题", value: "2" },
        //   ],
        // },
        // {
        //   label: "状态",
        //   prop: "status",
        //   element: "el-select",
        //   options: [
        //     { label: "给点意见", value: "1" },
        //     { label: "售后问题", value: "2" },
        //   ],
        // },
        // {
        //   label: "提交时间",
        //   type: "date",
        //   prop: "timeRange",
        //   element: "el-date-picker",
        // },
        // {
        //   label: "学生",
        //   prop: "students",
        //   element: "el-input",
        // },
      ],
      tableData: [],
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
        roleKey: undefined,
        status: undefined,
        CH: undefined,
        FJH: undefined,
        LH: undefined,
        XH: undefined,
      },
    };
  },
  methods: {
    // 获取搜索表单提交的数据
    onSearch(val) {
      // 查询条件和分页数据合并
      const arr = Object.assign(this.queryParams, val);
      console.log(arr);
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
        (response) => {
          this.tableData = response.rows;
          this.total = response.total;
        }
      );
    },
  },
};
</script>

<style>
</style>